package org.xin;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.xin.common.GlableRun;

import java.io.IOException;

/**
 * @author ：xin
 * @date ：Created in 2021/9/29
 * @desc <p>  </p>
 * @modified By：$
 * @version: $
 */
@EnableEurekaServer
@SpringBootApplication
public class EurekaApp {
    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(EurekaApp.class);
        logInfo(application);
    }

    //启动成功
    private static void logInfo(ConfigurableApplicationContext application)  {
        Environment env = application.getEnvironment();
        //获取配置的端口
        //IPUtil.getServerIp()获取本机IP，本机使用Hutool工具
        String port = env.getProperty("server.port");

        GlableRun.start(port);
    }
}
